﻿// This file is part of Code4Public (http://code4public.codeplex.com)
// Copyright 2011 Sina Iravanian - <sina@sinairv.com>
//
// This source file(s) may be redistributed, altered and customized
// by any means PROVIDING the authors name and all copyright
// notices remain intact.
// THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED. USE IT AT YOUR OWN RISK. THE AUTHOR ACCEPTS NO
// LIABILITY FOR ANY DATA DAMAGE/LOSS THAT THIS PRODUCT MAY CAUSE.
// ------------------------------------------------------------------


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Code4Public.Languages.Error
{
    public class ParsingErrors
    {
        private List<ParsingErrorItemBase> listErrorItems = new List<ParsingErrorItemBase>();
        public ParsingErrorItemBase[] ParsingErrorItems
        {
            get
            {
                return listErrorItems.ToArray();
            }
        }

        public void Add(ParsingErrorItemBase item)
        {
            listErrorItems.Add(item);
        }

        public void AddRange(IEnumerable<ParsingErrorItemBase> items)
        {
            listErrorItems.AddRange(items);
        }

        public void Clear()
        {
            listErrorItems.Clear();
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            foreach (ParsingErrorItemBase errItem in listErrorItems)
            {
                sb.AppendLine(errItem.ToString());
            }

            return sb.ToString();
        }
    }
}
